#include "stdio.h"
#include "string.h"
#include "math.h"

int answer[102];
long int br,bi,b2;
double mob;
int end,no;


int di(int num,long int xr,long int xi)
{
	long a,b;
	int i,flag;

	if (xr==0 && xi==0) return 0;	
	if (num>100) 
	{
		no=1;
		return 0;
	}
	flag=-1;
	for (i=0;i<mob;i++)
	{
		a=br*(xr-i)+xi*bi;
		b=br*xi-bi*(xr-i);
		if ((a%b2==0)&&(b%b2==0))
		{
			flag=i;
			break;
		}
		if (flag!=-1) break;
	}

	if (flag==-1)
	{
		no=1;
		return 0;
	}
		
	answer[num]=flag;
	num++;end++;
	di(num,a/b2,b/b2);	
	return 0;
}


int main()
{
	int casen;
	long xr,xi;
	int i,j;
	FILE *in,*out;

/*	in=fopen("code.in","r");
	out=fopen("out.txt","w");*/
	in=stdin;
	out=stdout;
	fscanf(in,"%d",&casen);
	for (i=0; i<casen; i++)
	{
		for(j=0;j<=103;j++) answer[j]=-1;
		no=0;
		fscanf(in,"%ld%ld%ld%ld",&xr,&xi,&br,&bi);
		b2=br*br+bi*bi;
		mob=sqrt(b2);
		end=0;
		if (xr==0&&xi==0)
		{
			fprintf(out,"0\n");
			continue;
		}
		di(0,xr,xi);
		end--;		
		if (end==-1||no) fprintf(out,"The code cannot be decrypted.\n");
		else
		{
			for (j=end  ;j>0;j--) 
				fprintf(out,"%d,",answer[j]);
			fprintf(out,"%d\n",answer[0]);
		}
	}
	fclose(in);
	fclose(out);
	return 0;

} 

/*
*
problem name: Secret Code
		      from Central Europe 1999
problem description:
		数学题，X = a0 + a1B + a2B2 + ... + anBn
		题目给出，x和b（它们都是复数）
		要求你输出 a0 -- an 
		限制条件：|Xr|,|Xi| <= 1000000, |Br|,|Bi| <= 16
				  (|B| > 1)
				  0 <= ai < |B| 
				  n <= 100 
				  
note:周浩讲了这道题的算法我才做的。所以说不算我个人完成的吧。

problem: 
	新学到的防止输出-0的方法。
	假设a=-0;
	printf("%.2f",a+1e-8);
	
	
*/



















